﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using WcfInspectorLib;

namespace WcfService
{
    [ServiceContract(Namespace = "ywt.WcfTest")]
    public interface IFaultService
    {
        /// <summary>
        /// 直接抛出FaultException，此时不需要使用FaultContract标注方法
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        [Authorize("ywt.WcfTest", false)]
        void ThrowFault1();

        /// <summary>
        /// 当方法标注是IsOneWay，客户端收不到错误消息
        /// </summary>
        /// <returns></returns>
        [OperationContract(IsOneWay = true)]
        [Authorize("ywt.WcfTest")]
        void ThrowFault2();

        /// <summary>
        /// 抛出基元类型的FaultException<T>，需要使用FaultContract标注方法
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(string))]
        void ThrowFault3();

        /// <summary>
        /// 抛出自定义错误信息的FaultException<T>，需要使用FaultContract标注方法
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        [FaultContract(typeof(FaultInfo))]
        void ThrowFault4();
    }
}
